// pages/find/card/card-list.js
var app = getApp()
Page({
    /**
     * 页面的初始数据
     */
    data: {
    },
    onLoad: function (options) {
        this.loadData()
    },
    loadData() {
        let { page = 1, total = 2, list = [], loading = false } = this.data
        if (page > total || loading) {
            return
        }
        this.setData({ loading: true })
        getApp().http.get("city/member-card/keep-list", {
            data: { page, type: 1 }
        }).then(res => {
            page++
            total = res.data.total
            list.push(...res.data.items)
            this.setData({
                page, total, loading, list
            })
            wx.stopPullDownRefresh()
        })
    },
    onReachBottom() {
        this.loadData()
    },
    onPullDownRefresh() {
        this.setData({
            page: 1,
            total: 2,
            list: [],
            loading: false
        })
        this.loadData()
    }

})